// importM
import 'package:flutter/material.dart';
import 'package:flutterdemo/main01(%E5%9B%BE%E6%A0%87%E5%9B%BE%E7%89%87Text).dart';

// ignore: unused_import
import './MyIcon.dart';

import './res/listData.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Flutter Demo",
      theme: ThemeData(primarySwatch: Colors.blue),
      home: Scaffold(
        appBar: AppBar(
          title: Text("Flutter App", style: TextStyle(color: Colors.white)),
          backgroundColor: Colors.deepPurple,
        ),
        body: Button(),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(child: Text("Hello Flutter"));
  }
}

class Button extends StatelessWidget {
  const Button({super.key});

  @override
  Widget build(BuildContext context) {
    Color _color = Colors.red;
    return ListView(
      children: [
        Wrap(
          children: [
            ElevatedButton(
              onPressed: () {
                print("我被点击了");
              },
              child: Text("Im Button"),
            ),
            TextButton(
              onPressed: () {
                print("我是文本按钮");
              },
              child: Text("Im TextButton"),
            ),
            OutlinedButton(
              onPressed: () {
                print("我是边框按钮");
              },
              child: Text("Im OutLinedButton"),
            ),
            IconButton(
              onPressed: () {
                print("我是图标按钮");
              },
              icon: Icon(MyIcon.apex),
            ),
          ],
        ),
        SizedBox(width: 10),
        Wrap(
          children: [
            ElevatedButton.icon(
              onPressed: () {
                print("我是图标和文本按钮");
              },
              label: Text("启动"),
              icon: Icon(MyIcon.apex),
            ),
            TextButton.icon(
              onPressed: () {
                print("我是图标和文本按钮");
              },
              label: Text("启动"),
              icon: Icon(MyIcon.epic),
            ),
            OutlinedButton.icon(
              onPressed: () {
                print("我是图标和文本按钮");
              },
              label: Text("启动"),
              icon: Icon(MyIcon.gitlab),
            ),
          ],
        ),
        SizedBox(width: 10),
        Wrap(
          children: [
            ElevatedButton(
              style: ButtonStyle(
                // 背景颜色
                backgroundColor: MaterialStateProperty.all(Colors.red),
                // 文本颜色
                foregroundColor: MaterialStateProperty.all(Colors.black45),
              ),
              onPressed: () {},
              child: Text("普通按钮"),
            ),
          ],
        ),
        Wrap(
          children: [
            SizedBox(
              width: 300,
              height: 100,
              child: ElevatedButton(onPressed: () {}, child: Text("我是大按钮")),
            ),
            SizedBox(
              width: 100,
              height: 30,
              child: ElevatedButton.icon(
                onPressed: () {},
                label: Text("启动", style: TextStyle(fontSize: 5)),
                icon: Icon(MyIcon.apex, size: 10),
              ),
            ),
          ],
        ),
        Row(
          children: [
            Expanded(
              flex: 1,
              child: Container(
                margin: EdgeInsets.all(10),
                height: 30,
                child: ElevatedButton(
                  onPressed: () {},
                  style: ButtonStyle(
                    backgroundColor: MaterialStateProperty.all(
                      Colors.lightBlueAccent,
                    ),
                    foregroundColor: MaterialStateProperty.all(Colors.white),
                  ),
                  child: Text("我是一个按钮"),
                ),
              ),
            ),
          ],
        ),
        Row(
          children: [
            SizedBox(
              width: 100,
              height: 100,
              child: ElevatedButton(
                onPressed: () {},
                style: ButtonStyle(
                  shape: MaterialStateProperty.all(
                    CircleBorder(side: BorderSide()),
                  ),
                ),
                child: Text("圆形 "),
              ),
            ),
          ],
        ),
      ],
    );
  }
}
